<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition  xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui">
   
    <ui:define name="titulo">
        Web Banco
    </ui:define>
    
    <ui:define name="corpo">
        <p:focus />
        <h:form>           
                   
            <p:panel id="painelTransferencia" header="Transferência" >
                           
                <p:messages  id="mensagemNovo"  showDetail="true"  autoUpdate="true" showSummary="false">
                    <p:effect type="clip" event="load" for="mensagemNovo" delay="3000" speed="1000" >  
                        <f:param name="mode" value="'hide'" />  
                    </p:effect>             
                </p:messages>
                
                 <p:effect type="clip" event="load" for="painelTransferencia" speed="1000" >  
                    <f:param name="mode" value="'show'" />  
                </p:effect> 
                
                <h:panelGrid columns="2" cellpadding="10">

                    <h:outputLabel value="Nº Conta: " /> 
                    <p:inputText tabindex="1"   id="nConta" value="#{transferenciaMB.nContaDestino}" 
                                 requiredMessage="'Nº da Conta' de destino deve ser preenchida." required="true"  size="5">                        
                        
                        <p:ajax listener="#{transferenciaMB.validarNumeroContaFinal}" partialSubmit="true" event="change" update="nome,nConta" />
                                               
                    </p:inputText>
                    
                    <h:outputLabel value="Nome: " />
                    <p:inputText  id="nome" value="#{transferenciaMB.nomeCliente}" 
                                 readonly="#{transferenciaMB.nomeCliente!=null}" 
                                 disabled="#{transferenciaMB.nomeCliente==null}"  
                                 rendered="true" size="30">
                        
                    </p:inputText>
                   
                    <h:outputLabel value="Valor: " />
                    <p:inputText  tabindex="2"  id="valor" value="#{transferenciaMB.valor}" required="true" size="10" 
                                 requiredMessage="'Valor' deve ser preenchido.">
                        <f:convertNumber currencyCode="BRL"/>
                         <p:watermark for="valor" value="Ex: 0,00" />
                    </p:inputText>

                </h:panelGrid>

                <p:commandButton tabindex="4"  partialSubmit="true" immediate="true" ajax="false"  value="Voltar"  action="index"/> 
                
                <p:spacer width="50"/>
                
                <p:commandButton tabindex="3"  id="btnTransferir" ajax="true" value="Transferir" update="nome,valor,nConta" action="#{transferenciaMB.salvar}" />

            
            </p:panel>
            
             <p:defaultCommand target="btnTransferir"/>
        </h:form>          
    </ui:define>
    
</ui:composition>


